package com.asset.salesforce.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.apache.solr.analysis.LowerCaseFilterFactory;
import org.apache.solr.analysis.SnowballPorterFilterFactory;
import org.apache.solr.analysis.StandardTokenizerFactory;
import org.hibernate.search.annotations.Analyzer;
import org.hibernate.search.annotations.AnalyzerDef;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
import org.hibernate.search.annotations.Parameter;
import org.hibernate.search.annotations.Store;
import org.hibernate.search.annotations.TokenFilterDef;
import org.hibernate.search.annotations.TokenizerDef;




/**
 * The persistent class for the lead database table.
 * 
 */
@SuppressWarnings("serial")
@Entity
@Table(name="lead")
@Indexed
@AnalyzerDef(name="leadAnalyzer", tokenizer = @TokenizerDef(factory=StandardTokenizerFactory.class),
filters={@TokenFilterDef(factory=LowerCaseFilterFactory.class),
        @TokenFilterDef(factory=SnowballPorterFilterFactory.class,params={
                @Parameter(name="language",value="English")
        })
})
public class Lead implements Serializable{
       
		 private Integer id;
		 private Employee leadOwner;
		 private String fName;
		 private String lName;
		 private String companyName;
		 private String title;
		 private String phone;
		 private String mobile;
		 private String leadStatus;
		 private String email;
		 private String rating;
		 private City city;
		 private String webSite;
		 private Integer numOfEmp;
		 private Integer annualRevenue;
		 private String description;
		 private String leadSource;
		 private String industry;
		 private Boolean isConverted;
		 private Country country;
		 private String zipCode;
		 private String street;
		 private String state;
		 private Boolean isDeleted;
		 private Boolean isFollowed;
		 private String carsNum;
		 private String category;
		 private String inOutBound;
		 
		 private Date dateCreated;
		 private Date dateModified;		
		/**
		 * @return the id
		 */
        @Id
        @GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="lead_id_seq")
        @SequenceGenerator(name="lead_id_seq",sequenceName="lead_id_seq",allocationSize=1)
		public Integer getId() {
		        return id;
		}
		/**
		 * @param id the id to set
		 */
		public void setId(Integer id) {
		        this.id = id;
		}
		/**
		 * @return the leadOwnerId
		 */
		@ManyToOne
		@JoinColumn(name="lead_owner_id")
		@IndexedEmbedded
		public Employee getLeadOwner() {
		        return leadOwner;
		}
		/**
		 * @param leadOwnerId the leadOwnerId to set
		 */
		public void setLeadOwner(Employee leadOwner) {
		        this.leadOwner = leadOwner;
		}
		/**
		 * @return the fName
		 */
		@Column(name="f_name")
		@Field(index=Index.YES,store=Store.NO)
		@Analyzer(definition = "leadAnalyzer")
		public String getfName() {
		        return fName;
		}
		/**
		 * @param fName the fName to set
		 */
		public void setfName(String fName) {
		        this.fName = fName;
		}
		/**
		 * @return the lName
		 */
		@Column(name="l_name")
		@Field(index=Index.YES,store=Store.NO)
		@Analyzer(definition = "leadAnalyzer")
		public String getlName() {
		        return lName;
		}
		/**
		 * @param lName the lName to set
		 */
		public void setlName(String lName) {
		        this.lName = lName;
		}
		/**
		 * @return the companyName
		 */
		@Column(name="company_name")
		@Field(index=Index.YES,store=Store.NO)
		@Analyzer(definition = "leadAnalyzer")
		public String getCompanyName() {
		        return companyName;
		}
		/**
		 * @param companyName the companyName to set
		 */
		public void setCompanyName(String companyName) {
		        this.companyName = companyName;
		}
		/**
		 * @return the title
		 */
		@Column(name="title")
		@Field(index=Index.YES,store=Store.NO)
		@Analyzer(definition = "leadAnalyzer")
		public String getTitle() {
		        return title;
		}
		/**
		 * @param title the title to set
		 */
		public void setTitle(String title) {
		        this.title = title;
		}
		/**
		 * @return the phone
		 */
		@Column(name="phone")
		@Field(index=Index.YES,store=Store.NO)
		@Analyzer(definition = "leadAnalyzer")
		public String getPhone() {
		        return phone;
		}
		/**
		 * @param phone the phone to set
		 */
		public void setPhone(String phone) {
		        this.phone = phone;
		}
		/**
		 * @return the leadStatusId
		 */
		
		@Column(name="lead_status")
		public String getLeadStatus() {
				if(leadStatus!=null && leadStatus.equals("--none--")){
					return " ";
				}
				else{
					return leadStatus;
				}
		}
		/**
		 * @param leadStatusId the leadStatusId to set
		 */
		public void setLeadStatus(String leadStatus) {
		        this.leadStatus = leadStatus;
		}
		/**
		 * @return the email
		 */
		@Column(name="email")
		@Field(index=Index.YES,store=Store.NO)
		@Analyzer(definition = "leadAnalyzer")
		public String getEmail() {
		        return email;
		}
		/**
		 * @param email the email to set
		 */
		public void setEmail(String email) {
		        this.email = email;
		}
		/**
		 * @return the ratingId
		 */
		
		@Column(name="rating")
		public String getRating() {
			if(rating!=null && rating.equals("--none--")){
				return " ";
			}
			else{
				return rating;
			}
		}
		/**
		 * @param ratingId the ratingId to set
		 */
		public void setRating(String rating) {
		        this.rating = rating;
		}
		/**
		 * @return the cityId
		 */
		@ManyToOne
		@JoinColumn(name="city_id")
		public City getCity() {
		        return city;
		}
		/**
		 * @param cityId the cityId to set
		 */
		public void setCity(City city) {
		        this.city = city;
		}
		/**
		 * @return the webSite
		 */
		@Column(name="website")
		@Field(index=Index.YES,store=Store.NO)
		@Analyzer(definition = "leadAnalyzer")
		public String getWebSite() {
		        return webSite;
		}
		/**
		 * @param webSite the webSite to set
		 */
		public void setWebSite(String webSite) {
		        this.webSite = webSite;
		}
		/**
		 * @return the numOfEmp
		 */
		@Column(name="no_of_emp")
		public Integer getNumOfEmp() {
		        return numOfEmp;
		}
		/**
		 * @param numOfEmp the numOfEmp to set
		 */
		public void setNumOfEmp(Integer numOfEmp) {
		        this.numOfEmp = numOfEmp;
		}
		/**
		 * @return the annualRevenue
		 */
		@Column(name="annual_revenue")
		public Integer getAnnualRevenue() {
		        return annualRevenue;
		}
		/**
		 * @param annualRevenue the annualRevenue to set
		 */
		public void setAnnualRevenue(Integer annualRevenue) {
		        this.annualRevenue = annualRevenue;
		}
		/**
		 * @return the description
		 */
		@Column(name="description")
		@Field(index=Index.YES,store=Store.NO)
		@Analyzer(definition = "leadAnalyzer")
		public String getDescription() {
		        return description;
		}
		/**
		 * @param description the description to set
		 */
		public void setDescription(String description) {
		        this.description = description;
		}
		/**
		 * @return the leadSourceId
		 */
		
		@Column(name="lead_source")
		public String getLeadSource() {
		        return leadSource;
		}
		/**
		 * @param leadSourceId the leadSourceId to set
		 */
		public void setLeadSource(String leadSource) {
		        this.leadSource = leadSource;
		}
		/**
		 * @return the industryId
		 */
		
		@Column(name="industry")
		public String getIndustry() {
		        return industry;
		}
		/**
		 * @param industryId the industryId to set
		 */
		public void setIndustry(String industry) {
		        this.industry = industry;
		}
		/**
		 * @return the isConverted
		 */
		@Column(name="is_converted")
		@Field(index=Index.YES,store=Store.NO)
		@Analyzer(definition = "leadAnalyzer")
		public Boolean getIsConverted() {
		        return isConverted;
		}
		/**
		 * @param isConverted the isConverted to set
		 */
		public void setIsConverted(Boolean isConverted) {
		        this.isConverted = isConverted;
		}
		/**
		 * @return the countryId
		 */
		@ManyToOne
		@JoinColumn(name="country_id")
		public Country getCountry() {
		        return country;
		}
		/**
		 * @param countryId the countryId to set
		 */
		public void setCountry(Country country) {
		        this.country = country;
		}
		/**
		 * @return the zipCode
		 */
		@Column(name="zip_code")
		@Field(index=Index.YES,store=Store.NO)
		@Analyzer(definition = "leadAnalyzer")
		public String getZipCode() {
		        return zipCode;
		}
		/**
		 * @param zipCode the zipCode to set
		 */
		public void setZipCode(String zipCode) {
		        this.zipCode = zipCode;
		}
		/**
		 * @return the street
		 */
		@Column(name="street")
		@Field(index=Index.YES,store=Store.NO)
		@Analyzer(definition = "leadAnalyzer")
		public String getStreet() {
		        return street;
		}
		/**
		 * @param street the street to set
		 */
		public void setStreet(String street) {
		        this.street = street;
		}
		/**
		 * @return the state
		 */
		@Column(name="state")
		@Field(index=Index.YES,store=Store.NO)
		@Analyzer(definition = "leadAnalyzer")
		public String getState() {
		        return state;
		}
		/**
		 * @param state the state to set
		 */
		public void setState(String state) {
		        this.state = state;
		}
		/**
		 * @return the isDeleted
		 */
		@Column(name="is_deleted")
		@Field(index=Index.YES,store=Store.NO)
		@Analyzer(definition = "leadAnalyzer")
		public Boolean getIsDeleted() {
		        return isDeleted;
		}
		/**
		 * @param isDeleted the isDeleted to set
		 */
		public void setIsDeleted(Boolean isDeleted) {
		        this.isDeleted = isDeleted;
		}
		@Transient
		public Boolean getIsFollowed() {
		        return isFollowed;
		}
		public void setIsFollowed(Boolean isFollowed) {
		        this.isFollowed = isFollowed;
		}
		
		@Column(name="category")
		public String getCategory() {
		        return category;
		}
		public void setCategory(String category) {
		        this.category = category;
		}
		
		@Column(name="in_out_bound")
		public String getInOutBound() {
		        return inOutBound;
		}
		public void setInOutBound(String inOutBound) {
		        this.inOutBound = inOutBound;
		}
		
		@Column(name="need_num")
		public String getCarsNum() {
		        return carsNum;
		}
		public void setCarsNum(String carsNum) {
		        this.carsNum = carsNum;
		}
		/**
		 * @return the dateCreated
		 */
		@Temporal(value = TemporalType.TIMESTAMP)
		@Column(name="date_created")
		@Field(index=Index.YES,store=Store.NO)
		@Analyzer(definition = "leadAnalyzer")
		public Date getDateCreated() {
		        return dateCreated;
		}
		/**
		 * @param dateCreated the dateCreated to set
		 */
		public void setDateCreated(Date dateCreated) {
		        this.dateCreated = dateCreated;
		}
		/**
		 * @return the dateModified
		 */
		@Temporal(value = TemporalType.TIMESTAMP)
		@Column(name="date_modified")
		public Date getDateModified() {
		        return dateModified;
		}
		
		/**
		 * @param dateModified the dateModified to set
		 */
		public void setDateModified(Date dateModified) {
		        this.dateModified = dateModified;
		}
		/**
		 * @return the mobile
		 */
		@Column(name="mobile")
		@Field(index=Index.YES,store=Store.NO)
		@Analyzer(definition = "leadAnalyzer")
		public String getMobile() {
		        return mobile;
		}
		/**
		 * @param mobile the mobile to set
		 */
		public void setMobile(String mobile) {
		        this.mobile = mobile;
		}
}
